package cn.kginglam.demo.controller;

import cn.kginglam.demo.domain.BkUser;
import cn.kginglam.demo.server.BkUserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private BkUserServer userServer;

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public @ResponseBody
    BkUser reg(@RequestBody BkUser user) {

        BkUser reg = userServer.regiter(user);
        return reg;
    }


    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public @ResponseBody
    BkUser login(@RequestBody BkUser user) {

        BkUser loginer = userServer.login(user);
        return loginer;
    }
}
